<template>
  <view class="serveRemind">
    <view class="list" v-for="item in list" :key="item.transactionId">
      <view class="txt1">
        <view
          ><image src="../../static/iamges/indexjiing.png" mode=""></image
          >添富智投稳健组合</view
        >
        <text>{{happenTimeFun(item.transactionTime)}}</text>
      </view>
      <view class="txt2">
        <view class="black">{{item.transactionType}}</view>
        <view>{{item.transactionMoney}}</view>
      </view>
      <view class="txt3">
        <view>查看详情</view>
        <view>></view>
      </view>
      <view class="line"></view>
      <view class="txt3 txt4">
        <view>不再接受</view>
        <view>></view>
      </view>
    </view>

  </view>
</template>

<script>
	import {
	  createNamespacedHelpers
	 } from 'vuex';
	 const {
	  mapActions,
	  mapState
	 } = createNamespacedHelpers('user');
export default {
	 created() {
		 this.getiushui()
	},
  data() {
    return {
		list:[]
	};
  },
  computed:{
	
  },
  methods: {
	  ...mapActions(['transactionRecord']),
	  //获取交易记录
	  async getiushui(){
		  const data=await this.transactionRecord()
		  this.list=data.data
		  //console.log("list",this.list)
	  },
	  //转换时间戳
	   happenTimeFun(num) {
	  	let date = new Date(num);
	  	//时间戳为10位需*1000，时间戳为13位的话不需乘1000
	  	let y = date.getFullYear();
	  	let MM = date.getMonth() + 1;
	  	MM = MM < 10 ? ('0' + MM) : MM; //月补0
	  	let d = date.getDate();
	  	d = d < 10 ? ('0' + d) : d; //天补0
	  	let h = date.getHours();
	  	h = h < 10 ? ('0' + h) : h; //小时补0
	  	let m = date.getMinutes();
	  	m = m < 10 ? ('0' + m) : m; //分钟补0
	  	let s = date.getSeconds();
	  	s = s < 10 ? ('0' + s) : s; //秒补0
	  	return y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s;
	  },
	  //下拉刷新
	  onPullDownRefresh() {
	  	 this.getiushui()
	  	setTimeout(function() {
	  		uni.stopPullDownRefresh(); //停止下拉刷新动画
	  	}, 1000);
	  }
  },
};
</script>
<style lang="scss" scoped>
.serveRemind {
  background-color:#fafafa;
  padding: 20rpx;
  .list {
	  background-color: #ffffff;
	    padding: 24rpx;
		border-radius: 32rpx;
		margin: 30rpx;
    .txt1 {
      display: flex;
      justify-content: space-between;
	  align-items: center;
	  font-size: 24rpx;
      image {
        width: 40rpx;
        height: 30rpx;
		padding-right: 20rpx;
      }
	  text{
		color: rgb(173, 171, 171);
	  }
    }
    .txt2 {
      display: flex;
      justify-content: center;
      align-items: center;
      flex-direction: column;
	  padding: 50rpx;
	  font-size: 24rpx;color: rgb(173, 171, 171);
	  .black{
		   font-weight: bold;
		   font-size: 36rpx;
		   padding: 20rpx 0;
		   color: black;
	  }
    }
    .txt3 {
      display: flex;
	  justify-content: space-between;
    }
	.txt4{
	color: rgb(173, 171, 171);

	}
    .line {
      border-top: 2rpx solid rgb(173, 171, 171);
	  margin: 20rpx 0;
    }
  }
}
</style>
